<template>
  <div class="app">
    <h2>我自己的数据sum：{{ sum }}</h2>
    <h2 v-show="wanju">儿子给我的玩具：{{ wanju }}</h2>
    <button @click="add">点我把自己的sum+1</button>
    <Child :sum="sum" :sendToy="getToy"/>
  </div>
</template>

<script>
  import Child from "./components/Child";

  export default {
    name:'App',
    components:{Child},
    data() {
      return {
        sum:1,
        wanju:''
      }
    },
    methods: {
      add(){
        this.sum += 1
      },
      getToy(value){
        // console.log('我是父，收到玩具了',value)
        this.wanju = value
      }
    },
  }
</script>

<style>
  .app {
    background-color: #ddd;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px;
  }
</style>